package com.huawei.fastengine.fastview.util;

import com.huawei.fastengine.fastview.download.utils.log.FastViewLogUtils;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class DeviceUtils {
    private static final String TAG = "DeviceUtils";

    public static String systemPropertiesGet(String str) {
        Class cls;
        Object obj;
        Method declaredMethod;
        Class cls2;
        try {
            cls = Class.forName("android.os.SystemProperties");
            try {
                obj = cls;
                declaredMethod = cls.getDeclaredMethod("get", new Class[]{String.class});
            } catch (ClassNotFoundException e) {
                FastViewLogUtils.e(TAG, "class not found.");
                cls2 = cls;
                declaredMethod = null;
                if (declaredMethod != null) {
                    try {
                        return (String) declaredMethod.invoke(obj, new Object[]{str});
                    } catch (IllegalAccessException e2) {
                        FastViewLogUtils.e(TAG, "illegal access");
                        return null;
                    } catch (IllegalArgumentException e3) {
                        FastViewLogUtils.e(TAG, "illegal argument");
                        return null;
                    } catch (InvocationTargetException e4) {
                        FastViewLogUtils.e(TAG, "illegal invocation.");
                    }
                }
                return null;
            } catch (NoSuchMethodException e5) {
                FastViewLogUtils.e(TAG, "method not found.");
                cls2 = cls;
                declaredMethod = null;
                if (declaredMethod != null) {
                    return (String) declaredMethod.invoke(obj, new Object[]{str});
                }
                return null;
            }
        } catch (ClassNotFoundException e6) {
            cls = null;
            FastViewLogUtils.e(TAG, "class not found.");
            cls2 = cls;
            declaredMethod = null;
            if (declaredMethod != null) {
                return (String) declaredMethod.invoke(obj, new Object[]{str});
            }
            return null;
        } catch (NoSuchMethodException e7) {
            cls = null;
            FastViewLogUtils.e(TAG, "method not found.");
            cls2 = cls;
            declaredMethod = null;
            if (declaredMethod != null) {
                return (String) declaredMethod.invoke(obj, new Object[]{str});
            }
            return null;
        }
        if (declaredMethod != null) {
            return (String) declaredMethod.invoke(obj, new Object[]{str});
        }
        return null;
    }
}
